package org.neuedu.controller;

import jakarta.annotation.Resource;
import org.neuedu.common.ResultJson;
import org.neuedu.entity.MedicalRecord;
import org.neuedu.service.MedicalRecordService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author lzw
 * @since 2024-11-17
 */
@RestController
@RequestMapping("/medicalRecord")
public class MedicalRecordController {
    @Resource
    MedicalRecordService medicalRecordService;
    @PostMapping("/add")
    ResultJson<Boolean> add(MedicalRecord medicalRecord, Integer[] diseaseIds) {
        return ResultJson.success(medicalRecordService.add(medicalRecord, diseaseIds), "保存诊断结果成功");
    }
    @PostMapping("/update")
    ResultJson<Boolean> update(MedicalRecord medicalRecord, Integer[] diseaseIds) {
        return ResultJson.success(medicalRecordService.update(medicalRecord, diseaseIds), "保存诊断结果成功");
    }
    @GetMapping("/getByRegisterId")
    ResultJson<MedicalRecord> getByRegisterId (Integer id) {
        return ResultJson.success(medicalRecordService.getByRegisterId(id));
    }
    @PostMapping("/quezhen")
    ResultJson<Boolean> quezhen(Integer registerId, String diagnosis, String cure) {
        return ResultJson.success(medicalRecordService.quezhen(registerId, diagnosis, cure),"病人确诊完成");
    }
}
